﻿

namespace Mulala.Cavan.TestAppService.NannyModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Spring.Context;
    using NUnit.Framework;
    using Spring.Context.Support;
    using Mulala.Cavan.Application.MainBoundedContext.NannyModule;
    using Mulala.Cavan.Domain.MainBoundedContext.NannyModule;
    using Mulala.Cavan.Domain.Seedwork;
    using Mulala.Cavan.Application.MainBoundedContext.MulalaModule;

    public class TestNannyAppService
    {
        private IApplicationContext context;
        private INannyAppService NannyAppService { get; set; }

        [SetUp]
        public void SetUp()
        {
            context = ContextRegistry.GetContext();
            this.NannyAppService = context.GetObject(MulalaAppServiceConst.NANNYAPPSERVICE) as INannyAppService;
        }

        [Test]
        public void TestUpdateNannyToVip()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyVipStatus(nanny, true, 1);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToUnVip()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyVipStatus(nanny, false);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToRecommend()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyRecommendStatus(nanny, true, 1);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToUnRecommend()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyRecommendStatus(nanny, false);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToShow()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyOnlineStatus(nanny, true);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToUnShow()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyOnlineStatus(nanny, false);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToBid()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyBidStatus(nanny, true);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestUpdateNannyToUnBid()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<NannyStatus> result = this.NannyAppService.UpdateNannyBidStatus(nanny, false);

            Assert.AreEqual(true, result.IsSuccess);
        }

        [Test]
        public void TestDeleteNanny()
        {
            Nanny nanny = NannyFactory.CreateNanny(33);
            BoolGenericResult<Nanny> result = this.NannyAppService.Delete(nanny);

            Assert.AreEqual(true, result.IsSuccess);
        }
    }
}
